{% set dojo_id = dojo.reference_id if dojo else None %}
{% set module_id = module.id if module else None %}

<!DOCTYPE html>
<html>
  <head>
    <title>{{ Configs.ctf_name }}</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="{{ Configs.ctf_small_icon }}" type="image/x-icon">
    <link rel="stylesheet" href="{{ url_for('views.themes', path='css/fonts.css') }}">
    <link rel="stylesheet" href="{{ url_for('views.themes', path='css/main.css') }}">
    <link rel="stylesheet" href="{{ url_for('views.themes', path='css/core.css') }}">
    <link rel="stylesheet" href="{{ url_for('views.themes', path='css/custom.css') }}">
    <link rel="stylesheet" href="{{ url_for('views.themes', path='css/pokemon-msp.css') }}">
    {% block stylesheets %}
    {% endblock %}

    {{ Plugins.styles }}
    <script type="text/javascript">
      var init = {
	  'urlRoot': "{{ request.script_root }}",
	  'csrfNonce': "{{ Session.nonce }}",
	  'userMode': "{{ Configs.user_mode }}",
	  'userId': {{ Session.id }},
	  'start': {{ Configs.start | tojson }},
	  'end': {{ Configs.end | tojson }},
	  'theme_settings': {{ Configs.theme_settings | tojson }},
          'dojo': "{{ dojo_id if dojo else "" }}",
          'module': "{{ module_id if module else "" }}"
      }
    </script>
    {{ Configs.theme_header }}
  </head>
  <body>
    {% include "components/navbar.html" %}

    <main role="main">
      {% block content %}
      {{ content | safe}}
      {% endblock %}
    </main>

    <footer class="footer">
      <div class="container text-center">
	<a href="https://ctfd.io" class="text-secondary">
	  <small class="text-muted">复刻自 pwn.college，并由 CTFd 提供支持！</small>
	</a>
      </div>
    </footer>

    <script defer src="{{ url_for('views.themes', path='js/vendor.bundle.js') }}"></script>
    <script defer src="{{ url_for('views.themes', path='js/core.js') }}"></script>
    <script defer src="{{ url_for('views.themes', path='js/helpers.js') }}"></script>

    {% block entrypoint %}
    <script defer src="{{ url_for('views.themes', path='js/pages/main.js') }}"></script>
    {% endblock %}

    <script defer src="{{ url_for('views.themes', path='js/dojo/util.js') }}"></script>
    <script defer src="{{ url_for('views.themes', path='js/dojo/navbar.js') }}"></script>

    {% block scripts %}
    {% endblock %}

    {{ Plugins.scripts }}

    {{ Configs.theme_footer }}
  </body>
</html>
